<template>
	<view>
			<view class="top">
				<view class="top-one" type="primary">
					<image src="../../static/Mask Group.png" mode="" @tap="goDeliverHome">

					</image>
				</view>
				<view class="top-two" type="primary" @click="open1">
					<image src="../../static/Mask Group (1).png" mode="">
					</image>
				</view>
				<view class="top-three">
					<image src="../../static/Mask Group (2).png" mode="" @click="shunfeng">
					</image>
				</view>
			</view>
			<view class="botton" v-for="(index,item) in picList" :key="index">
				<view class="button-one">
					<image :src="basUrl + item.pictureUrl" mode=""></image>
					
				</view>
				<view class="button-four">
					<view class="button-two">
						<image :src="basUrl + item.pictureUrl" mode=""></image>
					</view>
					<view class="button-three">
						<image :src="basUrl + item.pictureUrl" mode=""></image>
					</view>
				</view>

			</view>

		<view class="dialog">

			<!-- //到店自取 -->
			<!-- #ifdef MP-WEIXIN -->
			<!-- <page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta> -->
			<!-- #endif -->
			<uni-popup ref="popup" :mask-click="false" @change="change">
				<view class="nei-rong">
					<image src="../../static/Group 12.png" mode="" class="img-one">
					</image>
					<view class="jiucan">请选择到店の就餐方式</view>
					<image src="../../static/Frame 49.png" mode="" class="img-two" @click="close"></image>
					<image src="../../static/Frame 50.png" mode="" class="img-three" @click="closetwos"></image>
				</view>
			</uni-popup>
			<!-- 顺丰快递 -->
			<uni-popup ref="popuptwo" :mask-click="false" @change="change">
				<view class="nei-rong">
					<image src="../../static/Group 12.png" mode="" class="img-one">
					</image>
					<view class="jiucantwo">您的距离超出外送范围，请选择「顺丰速递」
						或修改地址</view>
					<image src="../../static/Frame 49 (1).png" mode="" class="img-four" @click="closetwo"></image>
				</view>
			</uni-popup>
		</view>
	</view>

</template>

<script>
	import {getMainPic} from "@/api/home.js"
	import {basUrl} from "@/common/basUrl.js"
	export default {
		created() {
			this.getPic()
		},
		data() {
			return {
				basUrl:basUrl,
				show: false,
				picList:[],
			}
		},
		methods: {
			//显示首页图片
			getPic(){
				getMainPic().then(res=>{
					console.log(res);
					this.picList = res.rows
					console.log(this.picList);
				})
			},
			change(e) {
				this.show = e.show
			},
			// 去外送到家
			goDeliverHome() {
				uni.setStorage({
					key:"deliverHome",
					data:"外送到家"
				})	
				uni.navigateTo({
					url: "/pages/DeliverHome/DeliverHome"
				})
			},
			// 去顺丰
			shunfeng(data) {
				this.show = true;
				this.$refs.popuptwo.open('center')
			},
			closetwo() {
				this.$refs.popuptwo.close()
				uni.setStorage({
					key:"express",
					data:"顺丰快递"
				})
				uni.navigateTo({
					url: "/pages/Express/Express"
				})
			},

			// 店内就餐
			open1() {
				// console.log(111);
				// this.show = true;
				// console.log(222);
				this.$refs.popup.open();
				// console.log(333);
			},
			close() {
				
				this.$refs.popup.close()
				uni.setStorage({
					key:"InStoreDining",
					data:"店内就餐"
				})	
				uni.navigateTo({
					url: "/pages/PiceStore/PiceStore"
				})
			},
			// 打包带走
			closetwos() {
				this.$refs.popup.close()
				uni.setStorage({
					key:"packAndTakeAway",
					data:"打包带走"
				})	
				uni.navigateTo({
					url: "/pages/PiceStore/PiceStore?id="+data
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	.top {
		height: 206rpx;
		width: 100%;
		display: flex;
		margin-top: 34rpx;
		justify-content: space-evenly;

		.top-one {
			height: 160rpx;
			width: 206rpx;
			border-radius: 24rpx;
			background-color: white;
			margin-top: 20rpx;

			image {
				width: 206rpx;
				height: 120rpx;
				margin-top: 50rpx;
				border-radius: 24rpx;

			}
		}

		.top-two {
			height: 120rpx;
			width: 206rpx;
			border-radius: 24rpx;
			background-color: white;
			margin-top: 20rpx;

			image {
				width: 206rpx;
				height: 120rpx;
				margin-top: 50rpx;
				border-radius: 24rpx;
			}
		}

		.top-three {
			height: 160rpx;
			width: 206rpx;
			border-radius: 24rpx;
			background-color: white;
			margin-top: 20rpx;

			image {
				width: 206rpx;
				height: 120rpx;
				margin-top: 50rpx;
				border-radius: 24rpx;
			}
		}
	}

	.botton {
		width: 100%;
		display: flex;
		margin-top: 20rpx;
		justify-content: space-evenly;

		// order: 0;
		.button-one {
			width: 44%;
			height: 1100rpx;
			background: red;
			border-radius: 24rpx;
			image{
				width: 100%;
				height: 1100rpx;
				background-size: 100%;
			}


		}

		.button-four {
			width: 44%;
			height: 1100rpx;

			.button-two {
				width: 100%;
				height: 600rpx;
				background: blue;
				border-radius: 24rpx;
				image{
					width: 100%;
					height: 600rpx;
					background-size: 100%;
				}

			}

			.button-three {
				margin-top: 22rpx;
				width: 100%;
				height: 480rpx;
				background: blueviolet;
				border-radius: 24rpx;
				image{
					width: 100%;
					height: 480rpx;
					background-size: 100%;
				}

			}
		}



		// image {
		// 	border-radius: 12rpx;
		// 	width: 350rpx;
		// }
	}

	.nei-rong {
		width: 686rpx;
		height: 312rpx;
		background: #FFFFFF;
		border-radius: 24rpx;

		.img-one {
			height: 32rpx;
			width: 100rpx;
			margin-left: 300rpx;
		}

		.jiucan {
			width: 280rpx;
			height: 28rpx;
			font-family: 'PingFang SC';
			font-style: normal;
			font-weight: 400;
			font-size: 28rpx;
			line-height: 28rpx;
			text-align: center;
			color: #000000;
			margin-top: 50rpx;
			margin-left: 202rpx;
		}

		.jiucantwo {
			width: 560rpx;
			height: 82rpx;
			font-family: 'PingFang SC';
			font-style: normal;
			font-weight: 400;
			font-size: 28rpx;
			line-height: 28rpx;
			text-align: center;
			color: #000000;
			margin-top: 50rpx;
			margin-left: 60rpx;
		}

		.img-two {
			width: 280rpx;
			height: 120rpx;
			border-radius: 24rpx;
			margin-top: 50rpx;
			margin-left: 30rpx;
		}

		.img-three {
			width: 280rpx;
			height: 120rpx;
			border-radius: 24rpx;
			margin-left: 30rpx;
		}

		.img-four {
			width: 280rpx;
			height: 120rpx;
			border-radius: 24rpx;
			margin-left: 200rpx;
		}


	}

	@mixin flex {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
	}

	@mixin height {
		/* #ifndef APP-NVUE */
		height: 100%;
		/* #endif */
		/* #ifdef APP-NVUE */
		flex: 1;
		/* #endif */
	}

	.box {
		@include flex;
	}

	.button {
		@include flex;
		align-items: center;
		justify-content: center;
		flex: 1;
		height: 35px;
		margin: 0 5px;
		border-radius: 5px;
	}

	.example-body {
		background-color: #fff;
		padding: 10px 0;
	}

	.button-text {
		color: #fff;
		font-size: 12px;
	}

	.popup-content {
		@include flex;
		align-items: center;
		justify-content: center;
		padding: 15px;
		height: 50px;
		background-color: #fff;
	}

	.popup-height {
		@include height;
		width: 200px;
	}

	.text {
		font-size: 12px;
		color: #333;
	}

	.popup-success {
		color: #fff;
		background-color: #e1f3d8;
	}

	.popup-warn {
		color: #fff;
		background-color: #faecd8;
	}

	.popup-error {
		color: #fff;
		background-color: #fde2e2;
	}

	.popup-info {
		color: #fff;
		background-color: #f2f6fc;
	}

	.success-text {
		color: #09bb07;
	}

	.warn-text {
		color: #e6a23c;
	}

	.error-text {
		color: #f56c6c;
	}

	.info-text {
		color: #909399;
	}

	.dialog,
	.share {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
	}

	.dialog-box {
		padding: 10px;
	}

	.dialog .button,
	.share .button {
		/* #ifndef APP-NVUE */
		width: 100%;
		/* #endif */
		margin: 0;
		margin-top: 10px;
		padding: 3px 0;
		flex: 1;
	}

	.dialog-text {
		font-size: 14px;
		color: #333;
	}
</style>
